package com.gather.util;



public class ToXmlUtil {
	/**
	 * @Title: BaseMessageToXml
	 * @Description: 将BaseMessage转化为XML STRING对象
	 * @author lilei
	 * @param baseMessage
	 * @return
	 * @return String 返回类型
	 * @throws
	 *//*
	public static String BaseMessageToXml(BaseMessage baseMessage) {
		Document document = DocumentHelper.createDocument();

		Element rootEle = document.addElement("BaseMessage");

		rootEle.addElement("type").setText(String.valueOf(baseMessage.getType()));

		if (baseMessage.getType() == 1) {
			LiveMatch liveMatch = baseMessage.getLiveMatch();
			Element liveMatchEle = rootEle.addElement("liveMatch");
			liveMatchEle.addElement("target").setText(String.valueOf(liveMatch.getTarget()));
			liveMatchEle.addElement("matchFlag").setText(String.valueOf(liveMatch.getMatchFlag()));
			liveMatchEle.addElement("leagueName").setText(String.valueOf(liveMatch.getLeagueName()));
			liveMatchEle.addElement("matchName").setText(String.valueOf(liveMatch.getMatchName()));
			liveMatchEle.addElement("showTime").setText(String.valueOf(liveMatch.getShowTime()));
			liveMatchEle.addElement("systemTime").setText(String.valueOf(liveMatch.getSystemTime()));
			liveMatchEle.addElement("oldStartDate").setText(liveMatch.getOldStartDate());
			liveMatchEle.addElement("status").setText(String.valueOf(liveMatch.getStatus()));
			liveMatchEle.addElement("closeStatus").setText(String.valueOf(liveMatch.getCloseStatus()));
			liveMatchEle.addElement("homeYC").setText(String.valueOf(liveMatch.getHomeYC()));
			liveMatchEle.addElement("awayYC").setText(String.valueOf(liveMatch.getAwayYC()));
			liveMatchEle.addElement("homeGoal").setText(String.valueOf(liveMatch.getHomeGoal()));
			liveMatchEle.addElement("awayGoal").setText(String.valueOf(liveMatch.getAwayGoal()));
			liveMatchEle.addElement("homeStatus").setText(String.valueOf(liveMatch.getHomeStatus()));
			liveMatchEle.addElement("awayStatus").setText(String.valueOf(liveMatch.getAwayStatus()));
			liveMatchEle.addElement("currentSystemTime").setText(String.valueOf(liveMatch.getCurrentSystemTime()));
		} else if (baseMessage.getType() == 2) {
			FuboData fuboData = baseMessage.getFuboData();
			Element fuboDataEle = rootEle.addElement("fuboData");
			fuboDataEle.addElement("status").setText(String.valueOf(fuboData.getStatus()));
			// 联赛
			Element FuboSportinfoEles = fuboDataEle.addElement("FuboSportinfos");
			for (int i = 0; i < fuboData.getFuboSportinfos().size(); i++) {
				FuboSportinfo fs = fuboData.getFuboSportinfos().get(i);
				Element FuboSportinfoEle = FuboSportinfoEles.addElement("FuboSportinfo");
				FuboSportinfoEle.addElement("id").setText(String.valueOf(fs.getId()));
				FuboSportinfoEle.addElement("name").setText(String.valueOf(fs.getName()));
				// 赛事
				Element FuboMatchEles = FuboSportinfoEle.addElement("fuboMatchs");
				for (int j = 0; j < fs.getFuboMatchs().size(); j++) {
					FuboMatch fm = fs.getFuboMatchs().get(j);
					Element FuboMatchEle = FuboMatchEles.addElement("FuboMatch");
					FuboMatchEle.addElement("matchFlag").setText(String.valueOf(fm.getMatchFlag()));
					FuboMatchEle.addElement("id").setText(String.valueOf(fm.getId()));
					FuboMatchEle.addElement("name").setText(String.valueOf(fm.getName()));
					FuboMatchEle.addElement("oldStartDate").setText(fm.getOldStartDate());
					FuboMatchEle.addElement("startTime").setText(String.valueOf(fm.getStartTime()));
					// 玩法
					Element FuboPlayinfoEles = FuboMatchEle.addElement("fuboPlayinfos");
					for (int m = 0; m < fm.getFuboPlayinfos().size(); m++) {
						FuboPlayinfo fp = fm.getFuboPlayinfos().get(m);
						Element FuboPlayinfoEle = FuboPlayinfoEles.addElement("FuboPlayinfo");
						FuboPlayinfoEle.addElement("gametime").setText(String.valueOf(fp.getGametime()));
						FuboPlayinfoEle.addElement("name").setText(String.valueOf(fp.getName()));
						// 交易项
						Element FuboTradingItemEles = FuboPlayinfoEle.addElement("fuboTradingItem");
						for (int n = 0; n < fp.getFuboTradingItem().size(); n++) {
							FuboTradingItem ft = fp.getFuboTradingItem().get(n);
							Element FuboTradingItemEle = FuboTradingItemEles.addElement("FuboTradingItem");
							FuboTradingItemEle.addElement("id").setText(String.valueOf(ft.getId()));
							FuboTradingItemEle.addElement("name").setText(String.valueOf(ft.getName()));
							FuboTradingItemEle.addElement("ratio").setText(String.valueOf(ft.getRatio()));
						}
					}
				}
			}
		}

		return document.asXML();
	}
	
	
	*//**
	* @Title: ErrorOutputToXml
	* @Description: 将ErrorOutput转化为XML STRING对象
	* @author lilei 
	* @param errorOutput
	* @return
	* @return String        返回类型
	* @throws
	*//*
	public static String ErrorOutputToXml(ErrorOutput errorOutput) {
		Document document = DocumentHelper.createDocument();
		Element rootEle = document.addElement("ErrorOutput");
		rootEle.addElement("status").setText(String.valueOf(errorOutput.getStatus()));
		rootEle.addElement("remark").setText(String.valueOf(errorOutput.getRemark()));
		return document.asXML();
	}
	
	*//**
	* @Title: HeartbeatOutputToXml
	* @Description: 将HeartbeatOutput转化为XML STRING对象
	* @author lilei 
	* @param heartbeatOutput
	* @return
	* @return String        返回类型
	* @throws
	*//*
	public static String HeartbeatOutputToXml(HeartbeatOutput heartbeatOutput) {
		Document document = DocumentHelper.createDocument();
		Element rootEle = document.addElement("HeartbeatOutput");
		rootEle.addElement("status").setText(String.valueOf(heartbeatOutput.getStatus()));
		rootEle.addElement("remark").setText(String.valueOf(heartbeatOutput.getRemark()));
		return document.asXML();
	}
	

	
	*//**
	* @Title: NodeRegisterOutputToXml
	* @Description: 将NodeRegisterOutput转化为XML STRING对象
	* @author lilei 
	* @param nodeRegisterOutput
	* @return
	* @return String        返回类型
	* @throws
	*//*
	public static String NodeRegisterOutputToXml(NodeRegisterOutput nodeRegisterOutput) {
		Document document = DocumentHelper.createDocument();
		Element rootEle = document.addElement("NodeRegisterOutput");
		rootEle.addElement("status").setText(String.valueOf(nodeRegisterOutput.getStatus()));
		rootEle.addElement("remark").setText(String.valueOf(nodeRegisterOutput.getRemark()));
		return document.asXML();
	}
	
	*//**
	* @Title: MatchInfoDataOutputToXml
	* @Description: 将MatchInfoDataOutput转化为XML STRING对象
	* @author lilei 
	* @param matchInfoDataOutput
	* @return
	* @return String        返回类型
	* @throws
	*//*
	public static String MatchInfoDataOutputToXml(MatchInfoDataOutput matchInfoDataOutput) {
		Document document = DocumentHelper.createDocument();
		Element rootEle = document.addElement("MatchInfoDataOutput");
		rootEle.addElement("status").setText(String.valueOf(matchInfoDataOutput.getStatus()));
		rootEle.addElement("remark").setText(String.valueOf(matchInfoDataOutput.getRemark()));
		return document.asXML();
	}
	
	*//**
	* @Title: RatioDataOutputToXml
	* @Description: 将RatioDataOutput转化为XML STRING对象
	* @author lilei 
	* @param ratioDataOutput
	* @return
	* @return String        返回类型
	* @throws
	*//*
	public static String RatioDataOutputToXml(RatioDataOutput ratioDataOutput) {
		Document document = DocumentHelper.createDocument();
		Element rootEle = document.addElement("RatioDataOutput");
		rootEle.addElement("status").setText(String.valueOf(ratioDataOutput.getStatus()));
		rootEle.addElement("remark").setText(String.valueOf(ratioDataOutput.getRemark()));
		return document.asXML();
	}*/
}
